package com.mlf.factory.easyFactory.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

// 客户端使用
@RestController
public class PaymentController {
    @Autowired
    private PaymentFactory factory;
    
    @GetMapping("/pay")
    public void pay(@RequestParam String type, @RequestParam double amount) {
        PaymentService service = factory.getService(type);
        service.pay(amount);
    }
}